package com.coderman.common.starter.excelport.imports.config;


import com.coderman.common.starter.excelport.export.bean.ConverterFieldBean;
import com.coderman.common.starter.excelport.imports.service.InsertTaskService;
import com.coderman.common.starter.excelport.imports.service.ObjectConverter;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @Author fanchunshuai
 * @Date 2019/10/28 14
 * @Description:
 * 导出参数配置文件
 */
public class ImportBeanConfig {
    /**
     * 导入对象模型
     */
    private Object t;

    /**
     * 控制批量导入下每次导入多少
     */
    private int limitCount;

    /**
     * 使用批量导入 建议开启
     */
    private boolean useBatch;

    /**
     * 数据源替换,默认数据源转换
     */
    private ConcurrentHashMap<String, Map<String,Object>> metaDataMap;

    /**
     * 指定底层返回的数据格式是List<object>
     *     还是List<List<String>>
     * true:使用 List<object>
     * false:使用List<List<String>>
     */
    private boolean useObjectModel;

    /**
     * excel文件的地址
     */
    private String filePath;

    /**
     * 读取跳过前n行
     */
    private int skipRowNum;

    /**
     * 自定义转换器
     */
    private CopyOnWriteArrayList<ObjectConverter> objectConverter;

    /**
     * 有几个转换器就有几个过滤属性bean
     * key:表名
     * value:转换器bean
     */
    private CopyOnWriteArrayList<ConverterFieldBean> converterFieldBeanList;

    /**
     * 默认的字段对应的值
     * key:表名
     * value :实体entity对应的带有默认值的对象
     */
    private ConcurrentHashMap<String, Object> defaultColumnEntityMap;


    /**
     * InsertTaskService对应的实现类springBean
     * k:表名
     * v:springbean 名称
     */
    private ConcurrentHashMap<String, InsertTaskService> insertTaskServiceBeanMap;

    /**
     * 表名-实体entity映射
     */
    private ConcurrentHashMap<String,Class<?>> entityTableMap;


    public int getSkipRowNum() {
        return skipRowNum;
    }

    public void setSkipRowNum(int skipRowNum) {
        this.skipRowNum = skipRowNum;
    }

    public Object getT() {
        return t;
    }

    public void setT(Object t) {
        this.t = t;
    }

    public int getLimitCount() {
        return limitCount;
    }

    public void setLimitCount(int limitCount) {
        this.limitCount = limitCount;
    }


    public boolean isUseBatch() {
        return useBatch;
    }

    public void setUseBatch(boolean useBatch) {
        this.useBatch = useBatch;
    }

    public ConcurrentHashMap<String, Map<String, Object>> getMetaDataMap() {
        return metaDataMap;
    }

    public void setMetaDataMap(ConcurrentHashMap<String, Map<String, Object>> metaDataMap) {
        this.metaDataMap = metaDataMap;
    }

    public boolean isUseObjectModel() {
        return useObjectModel;
    }

    public void setUseObjectModel(boolean useObjectModel) {
        this.useObjectModel = useObjectModel;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public CopyOnWriteArrayList<ObjectConverter> getObjectConverter() {
        return objectConverter;
    }

    public void setObjectConverter(CopyOnWriteArrayList<ObjectConverter> objectConverter) {
        this.objectConverter = objectConverter;
    }

    public CopyOnWriteArrayList<ConverterFieldBean> getConverterFieldBeanList() {
        return converterFieldBeanList;
    }

    public void setConverterFieldBeanList(CopyOnWriteArrayList<ConverterFieldBean> converterFieldBeanList) {
        this.converterFieldBeanList = converterFieldBeanList;
    }

    public ConcurrentHashMap<String, Object> getDefaultColumnEntityMap() {
        return defaultColumnEntityMap;
    }

    public void setDefaultColumnEntityMap(ConcurrentHashMap<String, Object> defaultColumnEntityMap) {
        this.defaultColumnEntityMap = defaultColumnEntityMap;
    }

    public ConcurrentHashMap<String, InsertTaskService> getInsertTaskServiceBeanMap() {
        return insertTaskServiceBeanMap;
    }

    public void setInsertTaskServiceBeanMap(ConcurrentHashMap<String, InsertTaskService> insertTaskServiceBeanMap) {
        this.insertTaskServiceBeanMap = insertTaskServiceBeanMap;
    }

    public ConcurrentHashMap<String, Class<?>> getEntityTableMap() {
        return entityTableMap;
    }

    public void setEntityTableMap(ConcurrentHashMap<String, Class<?>> entityTableMap) {
        this.entityTableMap = entityTableMap;
    }
}
